﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AttributeFactory
{
    private static AttributeFactory _instance;
    public static AttributeFactory GetInstance
    {
        get
        {
            if (_instance == null)
            {
                _instance = new AttributeFactory();
            }

            return _instance;                
        }
    }

    private Dictionary<int, Attribute> flyWeightDict = new Dictionary<int, Attribute>();

    public AttributeFactory()
    {
        flyWeightDict.Add(0, new Attribute() { ID = 0, name = "0", attack = 0 });
        flyWeightDict.Add(1, new Attribute() { ID = 1, name = "1", attack = 1 });
    }

    public Attribute GetAttribute(int ID)
    {
        if (flyWeightDict.ContainsKey(ID))
        {
            return flyWeightDict[ID];
        }

        return null;
    }
}
